package com.liuya.db.sql;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;

/**
 * 表达式from
 */
public class From implements SQLElement, java.io.Serializable  {
	private Collection tables = new ArrayList();

	public String toSQL() {
		StringBuffer buf = new StringBuffer();
		buf.append("\n").append(" FROM ");
		if (tables.size() > 0) {
			Iterator itr = tables.iterator();
			Table table = (Table) itr.next();
			buf.append(table.toSQL());
			while (itr.hasNext()) {
				table = (Table) itr.next();
				buf.append(",").append(table.toSQL());
			}
		}
		return buf.toString();
	}

	public Collection getTables() {
		return tables;
	}

	public void setTables(Collection tables) {
		this.tables = tables;
	}
}
